package javaBase.nowcoder.HJ86_A_求最大连续bit数;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String s = Integer.toBinaryString(Integer.parseInt(str));
        int max_length = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '1') {
                int length = 1;
                for (int j = i + 1; j < s.length(); j++) {
                    if (s.charAt(j) == '1') {
                        length++;
                    } else {
                        break;
                    }
                }
                max_length = max_length > length ? max_length : length;

            }
        }
        System.out.println(max_length);
    }

}
